<template>
  <div class="top">
    <div class="content">
      <div class="left" @click="goHome">
        <img src="@/assets/imgs/logos/MikaLogo.png" class="logo" />
        <h1 class="title">Mika医疗挂号平台</h1>
      </div>
      <div class="right">
        <p class="help">帮助</p>
        <p @click="login()" v-if="!userStore.isLogin">登录/注册</p>
        <a-dropdown trigger="hover" v-else>
          <p>{{ userStore.userInfo.name }}</p>
          <template #content>
            <a-doption>实名认证</a-doption>
            <a-doption>挂号订单</a-doption>
            <a-doption>就诊人管理</a-doption>
            <a-doption>退出登录</a-doption>
          </template>
        </a-dropdown>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { useRouter } from "vue-router";
import useUserStore from "@/store/modules/user";
const $router = useRouter();
const userStore = useUserStore();

const goHome = () => {
  $router.push("/home");
};

const login = () => {
  userStore.changeVisible(true);
};
</script>

<style lang="scss" scoped>
.top {
  position: fixed;
  top: 0;
  z-index: 999;
  width: 100%;
  height: 70px;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;

  .content {
    width: 1200px;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .left {
      display: flex;
      justify-content: center;
      align-items: center;
      user-select: none;
      cursor: pointer;
      img {
        width: 50px;
        height: 50px;
        margin-right: 10px;
      }
      h1 {
        font-size: 28px;
        color: #165dff;
        opacity: 0.9;
        font-weight: 550;
        letter-spacing: 2px;
      }
    }

    .right {
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 14px;
      color: #bbb;
      p {
        cursor: pointer;
        &:hover {
          color: #165dff;
        }
      }

      .help {
        margin-right: 10px;
      }
    }
  }
}
</style>
